
package com.android.matmanual;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.PowerManager;
import android.os.SystemProperties;
import android.os.PowerManager.WakeLock;
import android.util.Log;
import android.widget.TextView;

public class CPUtemperatureTest extends Activity {

	TextView textView;
	WakeLock mWakeLock;
	private boolean run = true;
	int index = 1;
	private final Handler handler = new Handler();

	private final Runnable task = new Runnable() {

		@Override
		public void run() {
			// TODO Auto-generated method stub
			if (run) {
				handler.postDelayed(this, 1000);

			}
			setCUPValue();
		}
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle(getResources().getString(R.string.cputemperature_test));
		setContentView(R.layout.cputemperature_test);
	    PowerManager pm =
		           (PowerManager) getSystemService(POWER_SERVICE); 
		    mWakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, 
		          "XYTEST"); 
		    mWakeLock.acquire(); 
		textView = (TextView) this.findViewById(R.id.cpu_info);
		handler.postDelayed(task, 1000);
	}

	@Override
	protected void onResume() {
		super.onResume();
		handler.sendEmptyMessage(1);
	}

	public void setCUPValue() {
		String text = "";
		text = SystemProperties.get("vold.msmtherm");
		textView.setText(text);
		index++;
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
	}
}
		 